/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.edu.unal.bioingenium.kbmed.knowledge.similarity.vo;

import gnu.trove.map.hash.TObjectDoubleHashMap;
import gnu.trove.map.hash.TObjectFloatHashMap;

/**
 *
 * @author Alejandro Riveros Cruz
 */
public class CategoryInformationContentValues {

    /**
     * 
     */
    private String category;
    /**
     * 
     */
    private float maxIC;
    /**
     * 
     */
    private TObjectFloatHashMap<String> informationContentValuesMap;

    /**
     * 
     * @param category
     */
    public CategoryInformationContentValues(String category) {
        this.category = category;
        informationContentValuesMap = new TObjectFloatHashMap<String>();
    }

    /**
     * 
     * @param conceptId
     * @return
     */
    public float getInformationContentValue(String conceptId) {
        return informationContentValuesMap.get(conceptId);
    }

    /**
     * 
     * @param conceptId
     * @param icValues
     */
    public void addInformationContentValue(String conceptId, float icValues) {
        informationContentValuesMap.put(conceptId, icValues);
    }

    /**
     * 
     * @return
     */
    public String getCategory() {
        return category;
    }

    /**
     * 
     * @param category
     */
    public void setCategory(String category) {
        this.category = category;
    }

    /**
     * 
     * @return
     */
    public float getMaxIC() {
        return maxIC;
    }

    /**
     * 
     * @param maxIC
     */
    public void setMaxIC(float maxIC) {
        this.maxIC = maxIC;
    }

    /**
     * 
     */
    public void normalize() {
        for (String conceptId : informationContentValuesMap.keySet()) {
            informationContentValuesMap.put(conceptId, informationContentValuesMap.get(conceptId) / maxIC);
        }
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final CategoryInformationContentValues other = (CategoryInformationContentValues) obj;
        if ((this.category == null) ? (other.category != null) : !this.category.equals(other.category)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 79 * hash + (this.category != null ? this.category.hashCode() : 0);
        return hash;
    }
}
